import type { ApiRequest } from '@/types/apis.d'
// import type { IManagerData } from '@/types/permission/manager'
import { request } from '../index'
export interface SystemRequest {
  //======================系统配置========================
  //设置图片配置
  'system.set_base': {
    cms_code: string
  }
  //设置图片配置
  'system.set_image_set': {
    volume: number | undefined
    img_type: number[]
  }
  //获取影片信息设置
  'system.set_movie_set': {
    interface_type: number
    douban_movie_addr: string
    douban_person_addr: string
    // baidu_movie_addr: string
    // weiji_movie_addr: string
    // baidu_person_addr: string
    // weiji_person_addr: string
  }
  //设置图片域名配置
  'system.set_img_domain': {
    movie_cover: string
    atlas_cover: string
    article_cover: string
    person_cover: string
    atlas_content_cover: string
    adv_cover: string
  }
  //======================采集设置========================
  //更新采集视频设置
  'system.set_collect_video': {
    sync_cover: number
    put_in_time: number
    update_type: number
    random_popularity: number
    random_play: number[]
    random_score: number[]
    put_rule: number[]
    update_rule: number[]
    title_filter: string
    title_replace: string
  }
  //更新采集视频设置
  'system.set_collect_image': {
    sync_cover: number
    put_in_time: number
    random_popularity: number
    random_play: number[]
    random_score: number[]
    put_rule: number[]
    update_rule: number[]
    title_filter: string
    title_replace: string
  }
  //更新采集视频设置
  'system.set_collect_article': {
    sync_cover: number
    put_in_time: number
    random_popularity: number
    random_play: number[]
    random_score: number[]
    put_rule: number[]
    update_rule: number[]
    title_filter: string
    title_replace: string
  }
  //更新采集视频设置
  'system.set_collect_person': {
    sync_cover: number
    random_popularity: number
    random_views: number[]
    put_rule: number[]
    update_rule: number[]
    title_filter: string
    title_replace: string
  }
  //域名替换
  'system.domain_replace': {
    replace_type: number | undefined
    before_domain: string
    after_domain: string
    replace_option: number | undefined
  }
  //======================设置白名单========================
  //设置白名单
  'system.set_img_blank_set': {
    ip_list: string[]
  }
  //======================自定义配置========================
  //获取自定义配置
  'system.get_custom': {
    id: string | undefined
  }
  //添加自定义配置
  'system.add_custom': {
    title: string
    logo: string
    icon: string
    logo_shape: number
    status: number
  }
  //编辑自定义配置
  'system.update_custom': {
    id?: string | undefined
    title: string
    logo: string
    icon: string
    logo_shape: number
    status: number
  }
  //添加自定义配置
  'system.delete_custom': {
    id: string
  }
}

//======================系统配置========================
//获取基础配置
export const get_base = () => request.get('/v1/system/base/get')
//设置基础配置
export const set_base = (data?: ApiRequest['system.set_base']) =>
  request.post<'system.set_base', any[]>('/v1/system/base/create', data)
//获取图片配置
export const get_image_set = () => request.get('/v1/system/image_set/get')
//设置图片配置
export const set_image_set = (data?: ApiRequest['system.set_image_set']) =>
  request.post<'system.set_image_set', any[]>('/v1/system/image_set/create', data)
//获取影片配置
export const get_movie_set = () => request.get('/v1/system/get_movie_set/get')
//设置影片配置
export const set_movie_set = (data?: ApiRequest['system.set_movie_set']) =>
  request.post<'system.set_movie_set', any[]>('/v1/system/get_movie_set/create', data)

//获取图片域名配置
export const get_img_domain = () => request.get('/v1/system/img_domain_set/get')
//设置图片域名配置
export const set_img_domain = (data?: ApiRequest['system.set_img_domain']) =>
  request.post<'system.set_img_domain', any[]>('/v1/system/img_domain_set/create', data)
//======================采集设置========================
//获取视频设置
export const get_video = () => request.get('/v1/system/collect/video/get')
//设置视频设置
export const set_video = (data?: ApiRequest['system.set_collect_video']) =>
  request.post<'system.set_collect_video', any[]>('/v1/system/collect/video/create', data)

//获取图集设置
export const get_image = () => request.get('/v1/system/collect/atlas/get')
//设置图集设置
export const set_image = (data?: ApiRequest['system.set_collect_image']) =>
  request.post<'system.set_collect_image', any[]>('/v1/system/collect/atlas/create', data)

//获取文章设置
export const get_article = () => request.get('/v1/system/collect/article/get')
//设置文章设置
export const set_article = (data?: ApiRequest['system.set_collect_image']) =>
  request.post<'system.set_collect_image', any[]>('/v1/system/collect/article/create', data)

//获取文章设置
export const get_person = () => request.get('/v1/system/collect/person/get')
//设置文章设置
export const set_person = (data?: ApiRequest['system.set_collect_person']) =>
  request.post<'system.set_collect_person', any[]>('/v1/system/collect/person/create', data)

//域名替换
export const domain_replace = (params?: ApiRequest['system.domain_replace']) =>
  request.get<'system.domain_replace', any[]>('/v1/system/domain/replace', params)
//======================白名单设置========================

//获取白名单设置
export const get_white_list = () => request.get('/v1/system/img_blank_set/get')
//设置白名单设置
export const set_white_list = (data?: ApiRequest['system.set_img_blank_set']) =>
  request.post<'system.set_img_blank_set', any[]>('/v1/system/img_blank_set/create', data)
//======================自定义设置========================
//获取自定义配置
export const get_custom = (params?: ApiRequest['system.get_custom']) =>
  request.get<'system.get_custom', any[]>('/v1/system/custom_set/get', params)
//获取自定义配置列表
export const list_custom = () => request.get('/v1/system/custom_set/list')
//删除自定义配置
export const delete_custom = (params?: ApiRequest['system.delete_custom']) =>
  request.get<'system.delete_custom', any[]>('/v1/system/custom_set/delete', params)
//添加自定义配置
export const add_custom = (data?: ApiRequest['system.add_custom']) =>
  request.post<'system.add_custom', any[]>('/v1/system/custom_set/create', data)
//更新自定义配置
export const update_custom = (data?: ApiRequest['system.update_custom']) =>
  request.post<'system.update_custom', any[]>('/v1/system/custom_set/update', data)
//======================首頁数据========================
//获取更多信息
export const get_more_action = () => request.get('/v1/common/first_page/info')
//======================版本升级============================
//获取版本信息
export const get_upgrade_info = () => request.get('/v1/system/upgrade/get_info')
//在线升级
export const upgradeVersion = () => request.get('/v1/system/upgrade')
